package com.bcurtu.amigo.pojo;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
public class Grupo implements Serializable {

	private Integer id;
	private Date date;
	private String subject;
	private String body;
	
	private Collection<Amigo> amigos;

   @Id @GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
		
	@OneToMany(targetEntity=Amigo.class,cascade=CascadeType.ALL, mappedBy="grupo")
    public Collection<Amigo> getAmigos() {
		return amigos;
	}

	public void setAmigos(Collection<Amigo> amigos) {
		this.amigos = amigos;
	}

	@Basic
	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Basic
	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}
	
	
}
